<template>
    <div class="info">
        <h3>{{photoinfo.title}}</h3>
        <p class="subtitle">
            <span>发表时间:{{photoinfo.add_time | timeF}}</span>
            <span>评论次数:{{photoinfo.click}}</span>
        </p>
        <hr>
        <!-- 缩略图 -->
        <div id="thumbs">
         <vue-preview :slides="list" @close="handleClose"></vue-preview>
        </div>

        <div class="content" v-html="photoinfo.content">
        </div>

        <comment :id="this.id"> </comment>
    </div>
</template>
<script>
import {getpicinfo,getpto} from '@/api'
import comment from '../comments/comment'
export default {
    data(){
        return{
            photoinfo:{},
            id: this.$route.params.id,
            list:[]
        }
    },
    created(){
      getpicinfo({imgid:this.id}).then(res=>{
        //   console.log(res,54554);
        if(res.status ===0){
            this.photoinfo =res.message[0]
        }
      })

    //缩略图
        getpto({imgid:this.id}).then(res=>{
            // console.log(res,123);
            if(res.status ==0){
                res.message.forEach(item=>{
                    item.w =300,
                    item.h =300,
                    item.msrc = item.src
                });
                this.list = res.message
            }
        })
    },
    methods:{
            handleClose () {
        console.log('close event')
      }
    },
    components: {
        comment
    }
}
</script>
<style lang="scss" scoped>
.info {
  padding: 3px;
  h3 {
    color: #26a2ff;
    font-size: 15px;
    text-align: center;
    margin: 15px 0;
  }
  .subtitle {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
  }
  .content {
    font-size: 13px;
    line-height: 30px;
  }     

}
</style>
